Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Combining texp(ln(_t))* and texp(_t >=* *) for time dependent variables on Survival Analysis!!

    Hello! my dear STATA users!


    I have run a cox regression model dealing with time-varying covariates.
    I need to combine

    texp(ln(_t))
    texp(_t >= ) when I use tvc option.

    My bottom line is I want to analyze certain period of time given ln time t
    : Analyze when time t > 5 given ln(t)

    I try to combine as below in the first place, however, two commends give me the same coefficient.
    I guess those are the equivalent commend because the second one is to take natural log on both sides in texp ???

    1. stcox regudummy_new regu_brand tvc(time dependent variables) texp(_t>5)

    2. stcox regudummy_new regu_brand tvc((time dependent variables) texp(ln(_t)>ln(5))


    If I try

    3. stcox regudummy_new regu_brand tvc((time dependent variables) texp(ln(_t)>5),

    tvc gets omitted.


    Is there any code for my situation?
    I have looked through all the references during a month, ended up finding none.

    Many thanks for any help!!!♥


    For the reference,
    https://www.stata.com/manuals13/ststsplit.pdf
    According to the technical note it says,

    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    If our interest really were just in performing this test of the proportional-hazards assumption, we would not have had to use stsplit at all.

    We could have just typed . stcox age treat, tvc(age) to have fit a model including t*age, and if we wanted instead to include ln(t)*age or age*t ≥ 500, we could have typed .

    stcox age treat, tvc(age) texp(ln(_t)) .
    cstoc age treat, tvc(age) texp(_t >= 500)

    Still, it is worth understanding how stsplit could be used to obtain the same results for instances when stcox’s tvc() and texp() options are not rich enough to handle the desired specification.

    ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------




  • #2
    You are not showing the exact code you tried. I know that because you have no comma in the commands separating the options from the regression variables, and that would trigger syntax errors, so you would get no results at all. The devil in code is almost always in the details--it is important to show exactly what you did and exactly what you got--with no editing of any kind.

    All I can say is that I see no reason why specifying -texp(ln(_t) > ln(5))- should not work. It works for me:

    Code:
    . webuse cancer, clear
    (Patient Survival in Drug Trial)
    
    . 
    . stcox i.drug, tvc(age) texp(ln(_t) > ln(5))
    
             failure _d:  died
       analysis time _t:  studytime
    
    Iteration 0:   log likelihood = -99.911448
    Iteration 1:   log likelihood = -84.915845
    Iteration 2:   log likelihood = -84.253174
    Iteration 3:   log likelihood = -84.225088
    Iteration 4:   log likelihood = -84.225065
    Refining estimates:
    Iteration 0:   log likelihood = -84.225065
    
    Cox regression -- Breslow method for ties
    
    No. of subjects =           48                  Number of obs    =          48
    No. of failures =           31
    Time at risk    =          744
                                                    LR chi2(3)       =       31.37
    Log likelihood  =   -84.225065                  Prob > chi2      =      0.0000
    
    ------------------------------------------------------------------------------
              _t | Haz. Ratio   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
    main         |
            drug |
              2  |   .2021546   .0995192    -3.25   0.001     .0770271     .530547
              3  |   .0561102   .0363138    -4.45   0.000     .0157817    .1994936
    -------------+----------------------------------------------------------------
    tvc          |
             age |   1.095761   .0481327     2.08   0.037     1.005369    1.194279
    ------------------------------------------------------------------------------
    Note: Variables in tvc equation interacted with ln(_t)>ln(5).
    So I suspect the problem is something else in your actual code.

    Comment


    • #3
      Hi Clyde Schechter! Thanks for the kind reply!!

      Yeah, your answer
      (1) texp(ln(_t) > ln(5)) works for me as well.
      AND the result is the same when I do
      (2) texp(_t>5)
      That is my problem because I want to analyze texp(_t>5) base on log of time. If the results or (1) and (2) are the same, it is the code for texp(_t>5) not using log t??? ??

      For more details of my code,
      Here they are.
      Variables are many and messy so only difference is the number of variables.
      (Since I try to avoid time-dependent issues as possible as I can, I stack up the data set on the yearly basis although the duration is based on days. # of data is over 100,000)

      1. stcox regudummy_new regu_brand , nohr vce(robust) nolog strata(cate_d1) tvc(time dependent variables) texp(_t>5)

      2. stcox regudummy_new regu_brand , nohr vce(robust) nolog strata(cate_d1) tvc((time dependent variables) texp(ln(_t)>ln(5))

      3. stcox regudummy_new regu_brand , nohr vce(robust) nolog strata(cate_d1) tvc(time dependent variables) texp(_t>5) based on ln t ??????????????????



      Thanks!!!!

      Rachel

      Comment


      • #4
        You need to explain more clearly what you are trying to do. Of course, texp(ln(t) > ln(5)) is the same thing as texp(t > 5)!

        That is my problem because I want to analyze texp(_t>5) base on log of time.
        What does that even mean?

        The idea behind -tvc()- is that it overcomes the lack of proportional hazards for your variable by modeling a hazard ratio that varies as some function of time that you specify in -texp()-. If you specify -texp(_t)-, then the model will be one in which the hazard ratio for that variable grows (or shrinks as the case may be) linearly with t. If you specify -texp(ln(_t))-, it means that the hazard ratio for that variable grows (or shrinks) in proportion to log t. If you specify -texp(_t > 5)- it means that you will have one hazard ratio for time 0 through 5 and a different hazard ratio from time 5 to infinity. That will, of course, be the same thing you get with -texp(ln(_t) > ln(5))- as the two expressions are entirely equivalent. Whether you decide that _t > 5 on the basis of _t, or on the basis of ln(_t) > ln(5) makes no difference (except the latter takes longer to calculate). So I don't understand what you are trying to do.

        I suspect you are thinking about this in some entirely different way that is not correctly reflected in your use of -texp()- and is not coming across to me.

        Comment


        • #5
          Thank you again.

          I would like to mix the two things ; 1) the hazard ratio for that variable grows (or shrinks) in proportion to log t. 2) it means that you will have one hazard ratio for time 0 through 5 and a different hazard ratio from time 5 to infinity.

          >>> one hazard ratio for time 0 through 5 and a different hazard ratio from time 5 to infinity and the hazard ratio for that variable grows (or shrinks) in proportion to log t.

          Or it is impossible.

          That is why I tried texp(ln(_t) > ln(5))- in the first place and found out it is just texp(_t > 5).

          Thanks!

          Comment


          • #6
            The two things are, as stated, inconsistent with each other. If you have only two hazard ratios, one for time 0 to 5 and the other from 5 to infinity, then it is necessarily not in proportion to log t.

            Comment

            Working...
            X